<#import "../tpl/pageTep.ftl" as page>
<@page.pageBase currentMenu="已提货商品">
<style>
    #title {
        margin-top: 5.5px;
        margin-left: -35px;
    }
    form.form-horizontal{
        margin-left: 10px;
    }
    ul.panel-content{
        margin-left: 20px;
    }
    .button-primary{
        margin-left: -32px;
    }
    .returnBtn{
        margin-left: 10px;
        margin-top:-5px;
    }
</style>
<!--suppress ALL -->
<div class="xm-offline">
    <div class="row">
        <div class="panel-content">
            <div class="returnBtn panel-header">
                <a href="${basepath}/rest/manage/entrepot/toList">返回上一级</a>
            </div>
        </div>
        <div>
            <form id="searchForm" class="form-panel" action="${basepath}/rest/manage/pickup/loadData">
                <ul class="panel-content">
                    <li>
                        <div class="control-group span5">
                            <div class="search-controls  controls">
                                <input type="text" name="productName" id="title" value="" placeholder="搜索商品名称">
                            </div>
                        </div>
                        <div class="form-actions span2">
                            <button type="submit" class="button  button-primary">
                                搜索
                            </button>
                        </div>
                    </li>
                </ul>
            </form>
        </div>
    </div>
</div>
<div id="grid"></div>
<script>
    var Grid = BUI.Grid,
            Store = BUI.Data.Store,
            columns = [
                {title: '序号', dataIndex: 'id', elCls: 'center', width: '10%'},
                {title: '商品名称', dataIndex: 'productName', elCls: 'center', width: '20%'},
                {title: '规格', dataIndex: 'specInfo', elCls: 'center', width: '15%'},
                {title: '商品单价(元)', dataIndex: 'price', elCls: 'center', width: '10%',renderer:function(value){
                    var price=(Math.round(value*100)/100).toFixed(2);
                    return '<span>'+price+'</span>';
                }},
                {title: '提货时间', dataIndex: 'createTime', elCls: 'center', width: '15%'},
                {title: '提货数量', dataIndex: 'number', elCls: 'center', width: '15%'},
                {
                    title: '提货状态', dataIndex: 'isSent', elCls: 'center', width: '15%', renderer: function (value) {
                    switch (value) {
                        case '1':
                            return '<p>待发货</p>';
                        case '2':
                            return '<p>待收货</p>';
                        default :
                            return '<p>已完成</p>';
                    }
                }
                }
            ];

    var store = new Store({
                url: '/rest/manage/pickup/loadData',
                autoLoad: true, //自动加载数据
                params: { //配置初始请求的参数
                    length: '10',
                    userID: '${e.userID!}'
                },
                pageSize: 10,	// 配置分页数目
                root: 'list',
                totalProperty: 'total'
            }),
            grid = new Grid.Grid({
                render: '#grid',
                columns: columns,
                loadMask: true, //加载数据时显示屏蔽层
                store: store,
                plugins: [Grid.Plugins.CheckSelection], // 插件形式引入多选表格
                // 底部工具栏
                bbar: {
                    pagingBar: true
                }
            });
    grid.render();

    //搜索框表单
    var form = new BUI.Form.HForm({
        srcNode: '#searchForm'
    }).render();

    form.on('beforesubmit', function (ev) {
        //序列化成对象
        var obj = form.serializeToObject();
        obj.start = 0; //返回第一页
        store.load(obj);
        return false;
    });
</script>

</@page.pageBase>
